Processor
|
This assembler programming site deals with the older ARM processors - the ARM 2 and the ARM 3. Well written code should work on later ARM processors, including the StrongARM.
SWP
which swaps between registers and memory.
To determine which processor you have, you need to conduct a few tests:
Does it understand SWP? If not, it is an ARM 2 Does it understand CP15 instructions? If not, it is an ARM 250. It is an ARM 3.This method will probably fail on later processors. I do not have data on how to identify processors later than the ARM 3.
Set Arm3$Present Yes
RMEnsure ARM3Support 0.00 Set ARM3$Present No
Here is some code to determine the processor type:
REM Processor type REM REM by Richard Murray 26th April 1999 REM REM Downloaded from: http://www.heyrick.co.uk/assembler/ DIM code% 256 FOR loop% = 0 TO 2 STEP 2 P% = code% [ OPT loop% STMFD R13!, {R1-R12, R14} ; Preserve registers MOV R0, #1 ; Set up a handler for ADR R1, unknown_instruction ; unknown instructions MOV R2, #0 MOV R3, #0 SWI "OS_ChangeEnvironment" SWI "OS_EnterOS" ; Enter SVC mode MOV R0, #2 \ Test for ARM 250 or better. ADR R2, safe_word ; Make R2 point somewhere safe EQUD &E1021091 ; "SWP R1, R1, [R2]" MOV R0, #250 \ Test for ARM 3. CMP R0, #250 ; Compare R0 with 250. EQUD &EE101F10 ; "MRCEQ CP15, 0, R1, C0, C0" MOV R0, #3 TSTP PC, #&F0000000 ; Return to USR mode. MOV R0, R0 LDMFD R13!, {R1-R12, PC}^ ; Restore registers and exit. .unknown_instruction ADDS PC, R14, #4 ; Upon unknown instruction, skip ; PC on beyond the MOV instruction. .safe_word EQUD 0 ] NEXT a% = USR(code%) CASE a% OF WHEN 2 : PRINT "Running on an ARM 2" WHEN 250 : PRINT "Running on an ARM 250" WHEN 3 : PRINT "Running on an ARM 3" OTHERWISE : PRINT "Running on unknown processor (reply = "+STR$(a%)+")" ENDCASE END
This software has only been tested on an ARM 3 processor.